package com.edu.chat.web.covert;

import com.edu.chat.web.controller.vo.CategoryVO;
import com.edu.chat.web.dto.CategoryNodeDTO;
import com.edu.chat.web.model.CsCategories;

/**
 * @program: KQAIA
 * @description:
 * @author: 无恙
 * @create: 2025-03-20 21:55
 **/


public class CategoryCovert {

	public static CsCategories convert(CategoryVO categoryVO) {
		CsCategories csCategories = new CsCategories();
		csCategories.setLibraryId(categoryVO.getLibraryId());
		csCategories.setParentCategoryId(categoryVO.getParentCategoryId());
		csCategories.setTitle(categoryVO.getName());
		csCategories.setDescription(categoryVO.getDescription());
		return csCategories;
	}

	public static CategoryNodeDTO convert(CsCategories csCategories) {
		CategoryNodeDTO categoryNodeDTO = new CategoryNodeDTO();
		categoryNodeDTO.setCategoryId(String.valueOf(csCategories.getId()));
		categoryNodeDTO.setName(csCategories.getTitle());
		categoryNodeDTO.setParentCategoryId(String.valueOf(csCategories.getParentCategoryId()));
		categoryNodeDTO.setDescription(csCategories.getDescription());
		return categoryNodeDTO;
	}

}
